*****************************************************************************************************************************************************
* PROJECT: 		Exposure to the COVID-19 Stock Market Crash and its Effect on Household Expectations
* DATE: 		Nov 2020
* CONTENT: 		TABLES
* AUTHORS: 		Tobin Hanspal, Johannes Wohlfart, Anni Weber
*****************************************************************************************************************************************************

		clear all
		set scheme lean2
		global pm = char(177)
		set more off
		gl date = c(current_date)
		graph set window fontface "cmr10"
	
		
* set cd as /Replication_files_HanspalWeberWohlfart2020/


*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~						
** Table 4
*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~	
	
use data/processed/data_1, clear 

foreach var of varlist expec_debthigher expec_morehrs expec_retirlater never_ownwealth never_owninc ///
realized_anychangestocks realized_morestocks realized_lessstocks planned_anychangestocks planned_morestocks planned_lessstocks {
	gen `var'_00=100* `var' 
}
* 

global controls ln_hhnetinc hhnetinc19_NR ///
	ln_ofinwealth_lvl ln_retirewealth_lvl ///
	ln_realestate_lvl realestJan20_NR ///
	ln_debt_lvl  debtJan20_NR ///
	stockinvestor riskshare_finwealth_Jan201 stockexperience ///
	i.agecat male married separated_divorced widowed ///	
	highschool some_college_associate_degree atleast_bachelor  ///
	z_decisionmaker mainearner_alone self_empl retired unempl empl_other z_constrained ///
	republican other_party NR_party  ///
	i.region ///
	i.svydate

loc experiments "recovery_duration z_manip1 z_manip2 z_manip3 exp_ret_mean exp_ret_sd retdist_neg30 retdist_pos30"

preserve

clear all
eststo clear
estimates drop _all

set obs 10
qui gen x = 1
qui gen y = 1

loc columns = 0

foreach choice in `experiments' {

    loc ++columns
    qui eststo col`columns': reg x y

}

restore

loc colnum = 1
loc colnames ""


foreach choice in `experiments' {
reg `choice' treated prior $controls, r, if arm_fincrisis==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat2 = "`r(bstar)'": col`colnum'
estadd loc thisstat3 = "`r(sestar)'": col`colnum'

reg `choice' treated prior $controls, r, if arm_fincrisis==1 & percgap>0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat5 = "`r(bstar)'": col`colnum'
estadd loc thisstat6 = "`r(sestar)'": col`colnum'

reg `choice' treated prior $controls, r, if arm_fincrisis==1 & percgap>0 & stockowner==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat8 = "`r(bstar)'": col`colnum'
estadd loc thisstat9 = "`r(sestar)'": col`colnum'

***

reg `choice' treated prior $controls, r, if arm_dotcom==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat12 = "`r(bstar)'": col`colnum'
estadd loc thisstat13 = "`r(sestar)'": col`colnum'

reg `choice' treated prior $controls, r, if arm_dotcom==1 & percgap>0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat15 = "`r(bstar)'": col`colnum'
estadd loc thisstat16 = "`r(sestar)'": col`colnum'

reg `choice' treated prior $controls, r, if arm_dotcom==1 & percgap>0 & stockowner==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat18 = "`r(bstar)'": col`colnum'
estadd loc thisstat19 = "`r(sestar)'": col`colnum'

***

reg `choice' treated prior $controls, r, if arm_black==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat22 = "`r(bstar)'": col`colnum'
estadd loc thisstat23 = "`r(sestar)'": col`colnum'

reg `choice' treated prior $controls, r, if arm_black==1 & percgap<0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat25 = "`r(bstar)'": col`colnum'
estadd loc thisstat26 = "`r(sestar)'": col`colnum'

reg `choice' treated prior $controls, r, if arm_black==1 & percgap<0 & stockowner==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat28 = "`r(bstar)'": col`colnum'
estadd loc thisstat29 = "`r(sestar)'": col`colnum'



estadd loc thisstat31 "Yes": col`colnum'
*estadd loc thisstat36= `r2': col`colnum'
*estadd loc thisstat37 = `N': col`colnum'



loc ++colnum
loc colnames "`colnames' `"`: var la `choice''"'"

}

loc rowlabels " "{\bf Panel A: All}" "Info Fin. Crisis 2007" " " " {\bf Panel B: Underestimators}" "Info Fin. Crisis 2007" " " " {\bf Panel C: Under. \& $\text{Stocks}>0$}" "Info Fin. Crisis 2007" " " " " "\hline {\bf Panel D: All}" "Info Dot-com 2000" " " "{\bf Panel E: Underestimators}" "Info Dot-com 2000" " " "{\bf Panel F: Under. \& $\text{Stocks}>0$}" "Info Dot-com 2000" " " " " "\hline {\bf Panel G: All}" "Info Black Monday 1987" " " "{\bf Panel H: Overestimators}" "Info Black Monday 1987" " " "{\bf Panel I: Over. \& $\text{Stocks}>0$}" "Info Black Monday 1987" " " " " "\hline Individual controls" " 

forval i = 1/31 {
    loc rowstats "`rowstats' thisstat`i'"
}

esttab * using "Tables\Table4.tex", replace cells(none) booktabs nonotes nomtitles compress alignment(c) nogap noobs nobaselevels label stats(`rowstats', labels(`rowlabels')) ///
     mgroups("\shortstack{Stock\\recovery\\duration}" "\shortstack{Agree:\\Recovery\\many yrs.}" "\shortstack{Agree:\\Set back\\many yrs.}" "\shortstack{Agree:\\Recover\\2020}" ///
 "\shortstack{Stock\\return:\\Mean}" "\shortstack{Stock\\return:\\SD}" "\shortstack{Stock \\ return \\ <-30\%}" "\shortstack{Stock \\ return \\ >30\%}" , pattern(1 1 1 1 1 1 1 1  ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}))


